package com.jiukuaidao.zhulin.module.order;

import android.os.Bundle;
import android.util.Log;
import android.view.View;
import android.widget.ImageView;
import android.widget.RatingBar;
import android.widget.RelativeLayout;
import android.widget.TextView;

import com.jiukuaidao.library.base.BaseActivity;
import com.jiukuaidao.library.widget.recyclerview.XRecyclerView;
import com.jiukuaidao.zhulin.R;
import com.jiukuaidao.zhulin.data.TaskProvider;
import com.jiukuaidao.zhulin.entity.ApiOrderCommentPost;
import com.jiukuaidao.zhulin.entity.ApiOrderDetailInfo;
import com.jiukuaidao.zhulin.module.order.contract.OrderCommentContract;
import com.jiukuaidao.zhulin.module.order.presenter.OrderCommentPresenter;

import butterknife.BindView;
import butterknife.ButterKnife;
import butterknife.OnClick;

/**
 * T_winds
 * Date:  16.8.18
 * Description:
 */
public class OrderCommentActivity1 extends BaseActivity<OrderCommentContract.Presenter> implements OrderCommentContract.View {


    @BindView(R.id.titile_left_imageview)
    ImageView titileLeftImageview;
    @BindView(R.id.titile_text)
    TextView titileText;
    @BindView(R.id.titile_right_text)
    TextView titileRightText;
    @BindView(R.id.content_layout_title)
    RelativeLayout contentLayoutTitle;
    @BindView(R.id.common_bottom_text_value)
    TextView commonBottomTextValue;
    @BindView(R.id.order_comment_time)
    TextView orderCommentTime;
    @BindView(R.id.order_comment_time_value)
    TextView orderCommentTimeValue;
    @BindView(R.id.line4)
    View line4;
    @BindView(R.id.order_comment_value)
    TextView orderCommentValue;
    @BindView(R.id.order_comment_value_value)
    TextView orderCommentValueValue;
    @BindView(R.id.order_comment_tv_layout)
    RelativeLayout orderCommentTvLayout;
    @BindView(R.id.order_comment_service)
    TextView orderCommentService;
    @BindView(R.id.commodity_goods_comments_rbar)
    RatingBar commodityGoodsCommentsRbar;
    @BindView(R.id.order_comment_goods)
    XRecyclerView orderCommentGoods;

    private String mOrderNo;
    private ApiOrderDetailInfo mOrderDetailInfo;

    private static final String TAG = "OrderCommentActivity1";

    /**********************************************
     * Native
     *************************************************/

    private void initView() {

//        titileText.setText(R.string.order_comment_title);
//        commonBottomTextValue.setText(R.string.order_comment_bottom_text);


    }

    private void RefreshUI(ApiOrderDetailInfo data) {


    }

    /**********************************************
     * View
     *************************************************/

    @Override
    public void setOrderNo(String orderNo) {
        this.mOrderNo = orderNo;
    }

    @Override
    public String getOrderNo() {
        return this.mOrderNo;
    }

    @Override
    public void getOrderDetailDataSuc(ApiOrderDetailInfo data) {

        mOrderDetailInfo = data;
        RefreshUI(data);

        Log.i(TAG, "getOrderDetailDataSuc: " + data.orderNo);

    }

    @Override
    public ApiOrderDetailInfo getOrderInfo() {
        return mOrderDetailInfo;
    }

    @Override
    public void postCommentSuc() {

    }

    @Override
    public ApiOrderCommentPost getCommentPost() {
        return null;
    }


    /***********************************************
     * BaseActivity
     *************************************************/
    @Override
    protected View getTargetView() {
        return null;
    }

    @Override
    protected int getContentLayoutId() {
        return R.layout.activity_order_comment;
    }

    @Override
    protected void handleBundle(Bundle bundle) {

        setOrderNo(bundle.getString("orderNumber", ""));

    }

    @Override
    protected void init() {

        initView();
        new OrderCommentPresenter(TaskProvider.provideTasksRepository(this), this);
        mPresenter.start();

    }

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        // TODO: add setContentView(...) invocation
        ButterKnife.bind(this);
    }

    @OnClick(R.id.titile_left_imageview)
    public void onClick() {
    }

//    /************************************************
//     * Butterknife
//     **********************************************/
//    @OnClick(R.id.titile_left_imageview)
//    public void onClick() {
//
//        this.finish();
//        ToastUtil.show("KKKKKK", Toast.LENGTH_LONG);
//    }
}
